import 'package:flutter/material.dart';
import 'popup_menu_button_demo.dart';
import 'check_box_demo.dart';
import 'dateDemo.dart';
import 'simpleDialog_demo.dart';
import 'alertDialog_demo.dart';
import 'bottomSheet_demo.dart';
import 'snackBar_demo.dart';
import 'extendPanel_demo.dart';
import 'chip_demo.dart';
import 'dataTable_demo.dart';
import 'paginatedDataTableDemo.dart';
import 'card_demo.dart';
import 'steper_demo.dart';
import 'StatelessWidget_demo.dart';
import 'stream_demo.dart';
import 'rxdart_demo.dart';
import 'block_demo.dart';
import 'package:nihao_flutter/http/http_demo.dart';
import 'animation_demo.dart';
import 'I18n_demo.dart';

class MaterialComponentsDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
       return Scaffold(
        appBar: AppBar(
          title:Text('MaterialComponentsDemo'),
          elevation: 0.0,
        ),
        body: ListView(
          children: <Widget>[
             ListItem(title:'I18n_demo',page:I18nDemo()),
             ListItem(title:'AnimationDemo',page:AnimationDemo()),
             ListItem(title:'HttpDemo',page:HttpDemo()),
             ListItem(title:'BlockDemo',page:BlockDemo()),
             ListItem(title:'RxDartDemo',page:RxDartDemo()),
             ListItem(title:'StreamHomeDemo',page:StreamHomeDemo()),
             ListItem(title:'StatefulWidgetDemo',page:StatelessWidgetDemo()),
             ListItem(title:'SteperDemo',page:SteperDemo()),
             ListItem(title:'CardDemo',page:CardDemo()),
             ListItem(title:'PaginatedDataTableDemo',page:PaginatedDataTableDemo()),
             ListItem(title:'DataTableDemo',page:DataTableDemo()),
             ListItem(title:'chipDemo',page: chipDemo()),
             ListItem(title:'ExtendPanelDemo',page: ExpansionPanelDemo()),
             ListItem(title:'SnackBarDemo',page: SnackBarDemo()),
             ListItem(title:'AlertDialogDemo',page: AlertDialogDemo()),
             ListItem(title:'BottomSheetDemo',page: BottomSheetDemo()),
             ListItem(title:'simpleDialog_demo',page: SimpleDialogDemo()),
             ListItem(title:'dateDemo',page: DateDemo()),
             ListItem(title:'CheckBoxDemo',page: CheckBoxDemo()),
             ListItem(title:'PopupMenuButtonDemo',page: PopupMenuButtonDemo()),
             ListItem(title:'ButtonDemo',page: ButtonDemo()),
             ListItem(title:'FloatingActionButtonDemo',page: FloatingActionButtonDemo())
          ],
        ),
       
       );

  }
}

class ButtonDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
   final Widget FlatButtonDemo =  Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                  FlatButton(
                   onPressed: (){}, 
                   child: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   ),
                 FlatButton.icon(
                   onPressed: (){}, 
                   icon: Icon(Icons.add),
                   label: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   )
               ],
            );
    final Widget RisedButtonDemo =  Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                  RaisedButton(
                   onPressed: (){}, 
                   child: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   elevation: 12,
                   ),
                 SizedBox(width:10),
                 RaisedButton.icon(
                   onPressed: (){}, 
                   icon: Icon(Icons.add),
                   label: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   elevation: 12,
                   )
               ],
            );
    final Widget OutLineButtonDemo =  Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                  OutlineButton(
                   onPressed: (){}, 
                   child: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   borderSide: BorderSide(
                     color:Colors.black
                   ),
                   highlightedBorderColor: Colors.grey,
                   shape: BeveledRectangleBorder(
                     borderRadius:BorderRadius.circular(10)
                   ),
                   ),
                 SizedBox(width:10),
                 OutlineButton.icon(
                   onPressed: (){}, 
                   icon: Icon(Icons.add),
                   label: Text('Button'),
                   splashColor: Colors.grey,
                   textColor: Colors.blue,
                   )
               ],
            );
          final Widget FixOutLineButtonDemo =  Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                 Container(
                width: 160,
                height: 40,
                 child:OutlineButton(
                    onPressed: (){}, 
                    child: Text('Button'),
                    splashColor: Colors.grey,
                    textColor: Colors.blue,
                    borderSide: BorderSide(
                      color:Colors.black
                    ),
                   highlightedBorderColor: Colors.grey,
                   shape: BeveledRectangleBorder(
                     borderRadius:BorderRadius.circular(5)
                   ),
                   ),
                 ),
               ],
            );
           final Widget ExtendButtonDemo =  Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                 Expanded(
                 child:OutlineButton(
                    onPressed: (){}, 
                    child: Text('Button'),
                    splashColor: Colors.grey,
                    textColor: Colors.blue,
                    borderSide: BorderSide(
                      color:Colors.black
                    ),
                   highlightedBorderColor: Colors.grey,
                   shape: BeveledRectangleBorder(
                     borderRadius:BorderRadius.circular(5)
                   ),
                   ),
                 ),
                 SizedBox(width:10),
                 Expanded(
                  flex: 2,
                  child:OutlineButton(
                    onPressed: (){}, 
                    child: Text('Button'),
                    splashColor: Colors.grey,
                    textColor: Colors.blue,
                    borderSide: BorderSide(
                      color:Colors.black
                    ),
                   highlightedBorderColor: Colors.grey,
                   shape: BeveledRectangleBorder(
                     borderRadius:BorderRadius.circular(5)
                   ),
                   ),
                 ),
               ],
            );

     return Scaffold(
        appBar: AppBar(
          title:Text('ButtonDemo'),
          elevation: 0.0,
        ),
        body: Container(
         padding: EdgeInsets.all(10),
         child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ExtendButtonDemo
          ],
         ),
        ),
    );
  }
}

class _WidgetDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
     return Scaffold(
        appBar: AppBar(
          title:Text('_WidgetDemo'),
          elevation: 0.0,
        ),
        body: Container(
         padding: EdgeInsets.all(10),
         child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Row(
               mainAxisAlignment: MainAxisAlignment.center,
               children: <Widget>[
                 
               ],
            )
          ],
         ),
        ),
    );
  }
}

class ListItem extends StatelessWidget {
  final String title;
  final Widget page;
  ListItem({
     this.title,
     this.page
  });
  @override
  Widget build(BuildContext context) {
    return ListTile(
      title: Text(title),
      onTap:(){
        Navigator.of(context).push(
           MaterialPageRoute(builder: (context) => page),
        );
      },
      
    );
  }
}


class FloatingActionButtonDemo extends StatelessWidget {
  final Widget  _floatingActionButton = FloatingActionButton(
    onPressed:(){},
    child: Icon(Icons.add),
    elevation: 0.0,
    backgroundColor: Colors.green,
    // shape: BeveledRectangleBorder(
    //   borderRadius : BorderRadius.circular(10)
    // ),

  );

 final Widget  _floatingActionButtonExtended = FloatingActionButton.extended(
    onPressed:(){},
    icon: Icon(Icons.add),
    label: Text('Add'),
    elevation: 0.0,
    backgroundColor: Colors.green,
    shape: BeveledRectangleBorder(
      borderRadius : BorderRadius.circular(10)
    ),
  );

  
  @override
  Widget build(BuildContext context) {
       return Scaffold(
        appBar: AppBar(
          title:Text('FloatingActionButtonDemo'),
          elevation: 0.0,
        ),
        floatingActionButton: _floatingActionButton,
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        bottomNavigationBar: BottomAppBar(
          child: Container(
            height: 80,
          ),
          shape: CircularNotchedRectangle(),
        ),
       );

  }
}